package com.example.sonone.incepter;

import lombok.extern.slf4j.Slf4j;
import org.springframework.web.servlet.HandlerInterceptor;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * @author ：杨过
 * @date ：Created in 2020/2/14
 * @version: V1.0
 * @slogan: 天下风云出我辈，一入代码岁月催
 * @description:
 **/
@Slf4j
public class AuthInterceptorHandler implements HandlerInterceptor {


    public final static String GLOBAL_JWT_USER_INFO = "jwttoken:usermember:info";

    @Override
    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
        log.info("进入前置拦截器");


        String token = request.getHeader("loginToken");
        System.out.println(token);
        return true;
    }

    protected void print(HttpServletResponse response, String message) throws Exception {
        /**
         * 设置响应头
         */
//        response.setHeader("Content-Type","application/json");
//        response.setCharacterEncoding("UTF-8");
//        String result = new ObjectMapper().writeValueAsString(CommonResult.forbidden(message));
//        response.getWriter().print(result);

    }
}
